import 'package:flutter/cupertino.dart';
import 'package:mobile_app.core/core/presentation/widgets/app_button.dart';
import 'package:mobile_app.home.core/core/presentation/theme/home_core_theme.dart';

class CardButton extends StatelessWidget {
  const CardButton({
    required this.onPressed,
    required this.child,
    this.color,
    this.width,
    this.height,
    this.borderRadius,
    super.key,
  });

  final VoidCallback? onPressed;
  final Widget child;
  final Color? color;
  final double? width;
  final double? height;
  final BorderRadius? borderRadius;

  @override
  Widget build(BuildContext context) {
    final effectiveBorderRadius = borderRadius ?? BorderRadius.circular(10);
    final effectiveHeight = height ?? 55;
    final effectiveWidth = width ?? double.infinity;
    final effectiveColor = color ?? HomeCoreTheme.of(context).cardButtonColor;

    return AppButton(
      borderRadius: effectiveBorderRadius,
      pressedOpacity: 0.3,
      color: effectiveColor,
      disabledColor: effectiveColor,
      onPressed: onPressed,
      child: ClipRRect(
        borderRadius: effectiveBorderRadius,
        child: SizedBox(
          height: effectiveHeight,
          width: effectiveWidth,
          child: Center(
            child: child,
          ),
        ),
      ),
    );
  }
}
